﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.MovieRecorder.ResolutionValidationRule
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System.Globalization;
using System.Windows.Controls;


namespace DnProcessSimulateCommands.MovieRecorder;

public class ResolutionValidationRule : ValidationRule
{
  public uint Min { get; set; }

  public uint Max { get; set; }

  public ResolutionValidationRule() => this.ValidatesOnTargetUpdated = true;

  public override ValidationResult Validate(object value, CultureInfo cultureInfo)
  {
    bool isValid = false;
    string s = value as string;
    uint result;
    if (!string.IsNullOrEmpty(s) && s.Length > 1 && uint.TryParse(s, out result) && result % 4U == 0U)
      isValid = result >= this.Min && result <= this.Max;
    return new ValidationResult(isValid, (object) null);
  }
}
